% Test the functions makeppftfilter and applyppftfilter against the
% preconditioned PPFT.
%
% Yoel Shkolnisky, December 2010.

explim=8;
for n=2.^(1:explim)
	precision='double';
	if n > 2^(explim-1)
		precision='single';
	end
    A=rand(n,n);
    tic;
    [pp1 pp2]=optimizedPPFT2D(A,precision);
    B=preconditionedAdjointPPFT2D(pp1,pp2,precision);
    t1=toc;
    
    H=makePPFTFilter2D(n,precision,1);
    tic;
    C=applyPPFTFilter2D(A,H,precision);
    t2=toc;

    err=norm(B(:)-C(:))./norm(B(:));    
    reportTestResult(n,err,t1/t2,precision);
end
